package syt.control;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import syt.action.ChatService;
import syt.action.User;


@RequestMapping("/userdo")
public class ChatController {

	@Autowired
	private ChatService chatService;
	
	
	@RequestMapping(value="/login", method=RequestMethod.POST)
	public String loginAction(HttpServletRequest request) {
		
		String name = request.getParameter("name");
		User user = new User(name);
		chatService.login(user);
		
		return "syt_index";
	}

	
	public void setChatService(ChatService chatService) {
		this.chatService = chatService;
	}
	
}
